﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;
using log4net.Config;

namespace ControlYSeguimiento.Logging
{

    public class Logger
    {
        private ILog logger;

        private static Logger _instance = null;
        private static object SyncRoot = new object();

        private Logger()
        {
            log4net.Config.XmlConfigurator.Configure();
            logger = log4net.LogManager.GetLogger(typeof(Logger));
        }

        public static Logger Instance
        {
            get
            {
                if (Logger._instance == null)
                {
                    lock (SyncRoot)
                    {
                        Logger._instance = new Logger();
                    }
                }

                return Logger._instance;
            }
        }

       
        public void Info(object type, object message)
        {
            logger = log4net.LogManager.GetLogger(type.GetType());
            logger.Info(message);
        }       
        public void Fatal(object type, object message)
        {
            logger = log4net.LogManager.GetLogger(type.GetType());
            logger.Fatal(message);
        }        
        public void Warn(object type, object message)
        {
            logger = log4net.LogManager.GetLogger(type.GetType());
            logger.Warn(message);
        }       
        public void Debug(object type, object message)
        {
            logger = log4net.LogManager.GetLogger(type.GetType());
            logger.Debug(message);
        }
    }
}
